echo 'Starting installing OS...'
UMOUNT_RESULT=`@@scriptPath@@ -H @@IP@@ -U @@USER@@ -P @@PASSWORD@@ connectvmm -T Disconnect`
if [[ $UMOUNT_RESULT =~ 'Success' ]]
then
    echo 'Umount success, mounting another ISO file...'
    mount_retry=1
    MOUNT_RESULT=0
    while [[ $mount_retry -lt 4 ]]
    do
        echo 'Now mounting >>>' $mount_retry
        mount_result=`@@scriptPath@@ -H @@IP@@ -U @@USER@@ -P @@PASSWORD@@ connectvmm -i @@ISO_URI@@ -T Connect` 
        if [[ $mount_result =~ 'Success' ]]
        then
            echo 'Mount success, modifying boot options...'
            let MOUNT_RESULT=1
            break
        else
            let mount_retry+=1
        fi
    done
    if [[ $MOUNT_RESULT -eq 1 ]]
    then
        MODIFY_RESULT=`@@scriptPath@@ -H @@IP@@ -U @@USER@@ -P @@PASSWORD@@ setsysboot -T Cd -TS Once -M UEFI`
        if [[ $MODIFY_RESULT =~ 'Success' ]]
        then
            echo 'Boot options modified, rebooting your server...'
            REBOOT_RESULT=`@@scriptPath@@ -H @@IP@@ -U @@USER@@ -P @@PASSWORD@@ syspowerctrl -T ForceRestart`
            if [[ $REBOOT_RESULT =~ 'Success' ]]
            then
                echo 'Install OK'
            else
                echo 'Reboot failed, I have no idea know what happend.'
                
            fi
        else
            echo 'Boot opitons not modified. I have no idea what happend.'
        fi
    else
        echo '3 times retrying mouting failed, please check if your nfs share path is available.'
    fi
else
    echo 'Umount failed'
fi